home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / demos / bike / macros / velod.sci < prev    next >
Text File  |  1999-09-16  |  2KB  |  50 lines

  1. //[]=velod(i)
  2. //------------ generation of the rear wheel
  3. nnn=24
  4. i1=(i-1)*nstep+1
  5. ang=xx(6,i1)*i1/n2
  6. l=(1/nnn)*( (2*%pi+ang)*(0:nnn)+ ang*(ones(1,nnn+1)-(0:nnn)))'
  7. dec = ones(l);sinl=r1*sin(l);cosl=r1*cos(l);
  8.   cphi1=cos(xx(4,i1));
  9.   sphi1=sin(xx(4,i1));
  10.   cthe1=cos(xx(5,i1));
  11.   sthe1=sin(xx(5,i1));
  12. //  unused 
  13. //  cpsi1=cos(xx(6,i1));
  14. //  spsi1=sin(xx(6,i1));
  15.   xrearar = cosl*cphi1-sinl*(sphi1.*cthe1)+dec*xx(1,i1);
  16.   yrearar=  cosl*sphi1+sinl*(cphi1.*cthe1)+dec*xx(2,i1);
  17.   zrearar = sinl*sthe1+dec*xx(3,i1);
  18. ang=xx(20,i1)*i1/380
  19. l=(1/nnn)*( (2*%pi+ang)*(0:nnn)+ ang*(ones(1,nnn+1)-(0:nnn)))'
  20. dec = ones(l);sinl=r1*sin(l);cosl=r1*cos(l);
  21.   cphi1=cos(xx(18,i1));
  22.   sphi1=sin(xx(18,i1));
  23.   cthe1=cos(xx(19,i1));
  24.   sthe1=sin(xx(19,i1));
  25. // unused
  26. // cpsi1=cos(xx(20,i1));
  27. // spsi1=sin(xx(20,i1));
  28.   xfrontar = cosl*cphi1-sinl*(sphi1.*cthe1)+dec*xx(21,i1);
  29.   yfrontar=  cosl*sphi1+sinl*(cphi1.*cthe1)+dec*xx(22,i1);
  30.   zfrontar = sinl*sthe1+dec*xx(23,i1);
  31.       xnr=ct*xfrontar-st*yfrontar;
  32.       ynr=cp*(st*xfrontar+ct*yfrontar)+sp*zfrontar;
  33.       xnt=ct*xf(:,i)-st*yf(:,i);
  34.       ynt=cp*(st*xf(:,i)+ct*yf(:,i))+sp*zf(:,i);
  35.       xnf=ct*xrearar-st*yrearar;
  36.       ynf=cp*(st*xrearar+ct*yrearar)+sp*zrearar;
  37.       xpoly(xnt,ynt,'lines');
  38.       xpoly(xnr,ynr,'lines');
  39.       xpoly(xnf,ynf,'lines');
  40.       [nn2,nn1]=size(xnr);
  41.       xx1=[xnr(1:nn2/2)';xnr((nn2/2+1):nn2)'];
  42.       yy1=[ynr(1:nn2/2)';ynr((nn2/2+1):nn2)'];
  43.       xsegs(xx1,yy1);
  44.       xx1=[xnf(1:nn2/2)';xnf((nn2/2+1):nn2)'];
  45.       yy1=[ynf(1:nn2/2)';ynf((nn2/2+1):nn2)'];
  46.       xsegs(xx1,yy1);
  47. //end
  48.  
  49.  
  50.